package com.orhon.smartcampus.modules.student.mm;



import java.util.List;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import com.orhon.smartcampus.modules.base.mm.DictionaryMapper;
import com.orhon.smartcampus.modules.base.mm.LangMapper;
import com.orhon.smartcampus.modules.base.mm.RegionMapper;
import com.orhon.smartcampus.modules.student.entity.Parents;
import com.orhon.smartcampus.modules.student.gqlModel.GQLParents;

@Mapper(
        uses = {
                LangMapper.class,
                RegionMapper.class,
                DictionaryMapper.class
        }
)
public interface ParentsMapper {


    ParentsMapper MAPPER = Mappers.getMapper(ParentsMapper.class);


    @Mappings({
            @Mapping(source = "id" , target = "id"),
            @Mapping(source = "studentId" , target = "studentId"),
            @Mapping(source = "parentName" , target = "parentName"),
            @Mapping(source = "relation" , target = "relation", qualifiedByName = "str2dic"),
            @Mapping(source = "nation" , target = "nation", qualifiedByName = "str2dic"),
            @Mapping(source = "gender" , target = "gender", qualifiedByName = "str2dic"),
            @Mapping(source = "idcard" , target = "idcard"),
            @Mapping(source = "isGuardian" , target = "isGuardian"),
            @Mapping(source = "postalAddress" , target = "postalAddress"),
            @Mapping(source = "picture" , target = "picture"),
            @Mapping(source = "telNumber" , target = "telNumber"),
            @Mapping(source = "createdAt" , target = "createdAt"),
            @Mapping(source = "updatedAt" , target = "updatedAt"),
            @Mapping(source = "deletedAt" , target = "deletedAt")
        
    })
    GQLParents toParents(Parents entity);
    
    @InheritConfiguration(name = "toParents")
    List<GQLParents> toParentsList(List<Parents> entities);
}
